//
//  HNSNGetMoneyModel.m
//  ZYManagementSystem
//
//  Created by 星道 on 17/6/15.
//  Copyright © 2017年 焕宁. All rights reserved.
//

#import "HNSNGetMoneyModel.h"

@implementation HNSNGetMoneyModel


+ (HNSNGetMoneyModel *(^)(NSDictionary *))SetupModel{

    return ^(NSDictionary *Dict) {

        return [self HN_ObjectWithKeyValus:Dict];
    };
}

+ (instancetype)HN_ObjectWithKeyValus:(NSDictionary *)Dict
{
    return [[self alloc] initWithDict:Dict];
}


- (instancetype)initWithDict:(NSDictionary *)Dict
{
    if (self = [super init]) {

        [self setValuesForKeysWithDictionary:Dict];
    }
    return self;
}


- (void)setValue:(id)value forKey:(NSString *)key{

    if ([key isEqualToString:@"trainLesson"]) {
        self.T_Name = [value[@"name"] isKindOfClass:[NSNull class]]?@"未知":value[@"name"];
    } else if ([key isEqualToString:@"buyer"])  {
        self.B_petName = value[@"petName"];
        self.B_username = value[@"username"];
    } else if ([key isEqualToString:@"id"]) {
        self.ID = value;
    } else if ([key isEqualToString:@"withdraw"]) {
        self.withdrawFlag = value[@"withdrawFlag"];
    } else if ([key isEqualToString:@"coursePackage"])
    {
        self.C_name = value[@"name"];
    } else {
        [super setValue:value forKey:key];
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    

}



- (HNSNGetMoneyModel *(^)(NSNumber *))SetupWithdrawMoney
{
    return  ^(NSNumber *WithdrawMoney) {

        self.withdrawMoney = WithdrawMoney;
        return self;
    };
}

- (void)customParam:(NSDictionary *)dict {

    if (![dict isKindOfClass:[NSNull class]] && dict) {

        self.canWithdrawCoins = dict[@"canWithdrawCoins"];
        self.haveWithdrawCoins = dict[@"haveWithdrawCoins"];
        self.totalCoins       = dict[@"totalCoins"];
    }
}
@end
